//-----------------------------------------------------------------------
// <copyright file="tblUserService.cs" company="Cyvee">
//     Copyright ? Cyvee. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using Scb.Framework;
using Robot.Entities;
using Robot.Data;
    
namespace Robot.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class tblUserService
    {
        #region tblUser

        public static void CreatetblUser(tblUser tblUser)
        {            
            try
            {
                tblUserDAO tblUserDAO = new tblUserDAO();
                tblUserDAO.CreatetblUser(tblUser);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreatetblUserException, ex);
            }
        }        

        public static void UpdatetblUser(tblUser tblUser)
        {            
            try
            {
                tblUserDAO tblUserDAO = new tblUserDAO();
                tblUserDAO.UpdatetblUser(tblUser);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdatetblUserException, ex);
            }
        }        

        public static void DeletetblUser(string peoplewise)
        {            
            try
            {
                tblUserDAO tblUserDAO = new tblUserDAO();
                tblUserDAO.DeletetblUser(peoplewise);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeletetblUserException, ex);
            }
        }
        
        public static tblUser GettblUser(string peoplewise)
        {            
            try
            {
                tblUserDAO tblUserDAO = new tblUserDAO();
                return tblUserDAO.GettblUser(peoplewise);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblUserException, ex);
            }
        }                

        public static tblUserCollection GettblUserList(tblUserColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                tblUserDAO tblUserDAO = new tblUserDAO();
                return tblUserDAO.GettblUserList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblUserListException, ex);
            }
        }        

        public static tblUserCollection GettblUserList(tblUserColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                tblUserDAO tblUserDAO = new tblUserDAO();
                return tblUserDAO.GettblUserList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblUserListException, ex);
            }
        }        

        #endregion
    }
}